public class Main {
    public static void main(String[] args) {
        DynamicArray dynamicArray = new DynamicArray();
        dynamicArray.addLast(1);
        dynamicArray.addLast(2);
        dynamicArray.addLast(3);
        dynamicArray.addLast(4);
        dynamicArray.add(2,5);
        for (int i = 0; i < 5; i++) {
            int i1 = dynamicArray.get(i);
            System.out.println(i1);
        }
        System.out.println();

        dynamicArray.forEach1((element)->{
            System.out.println(element);
        });

        System.out.println();

        for (Integer element:dynamicArray) {
            System.out.println(element);
        }

        System.out.println();

        dynamicArray.stream().forEach(element->{
            System.out.println(element);
        });

        System.out.println();

        int remove = dynamicArray.remove(2);
        System.out.println(remove);

        System.out.println();

        dynamicArray.stream().forEach(element->{
            System.out.println(element);
        });



    }

}